<template>
	<view>
		<cu-custom bgColor="bg-blue" :isBack="true">
			<block slot="backText">返回</block>
			<block slot="content">长者信息</block>
		</cu-custom>
		<view v-show="show">
		<view class="padding-sm" @click="getContent(info)">
			<view class="radius shadow shadow-lg bg-white det_top">
				<!-- 信息卡 -->
				<view class="information">
					<view class="image">
						<image src="../../../static/img/basics/u129.png" mode=""></image>
					</view>
					<view class="right">
						<view class="name">
							<view class="inner">{{info.oldBaseName}}</view>
							<view class="center">{{info.age}}岁</view>
							<!-- 0外出 false外出 -->
							<view class="cu-tag round bg-blue" v-if="!info.outStatus">外出</view>
						</view>
						<view class="room">
							<view class="room-left">
								<text>房间：</text>
								<text>{{info.roomName}}</text>
							</view>
							<view class="room-right">
								<text>床位：</text>
								<text>{{info.bedName}}</text>
							</view>
						</view>
						<view class="power">
							<view class="power-left">能力等级：</view>
							<view>{{info.abilityLevel}}</view>
						</view>
						<view class="power power-center">
							<view class="power-left">修养类型：</view>
							<view>{{info.cultureType}}</view>
						</view>
						<view class="power">
							<view class="power-left">责任护理员：</view>
							<view>{{info.responsePerson}}</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<!-- bottom -->
		<view class="condition">
			<view class="past">
				<view class="inner">
					<view class="past-line">身体状况</view>
					<view class="past-content" @click="goOut(0,info)">
						<view class="left">既往史：</view>
						<view>{{info.pastMedicalHistory}}</view>
					</view>
				</view>
			</view>

			<view class="past">
				<view class="inner">
					<view class="past-content" @click="goOut(1,info)">
						<view class="left">现病史：</view>
						<view>{{info.nowMedicalHistory}}</view>
					</view>
				</view>
			</view>

			<view class="pasts">
				<view class="inner" @click="goOut(2,info)">
					<view class="past-content">
						<view class="left">饮食：</view>
						<view>{{info.diet}}</view>
					</view>
				</view>
			</view>

			<!-- 家属信息 -->

		</view>
		<view class="condition"  style="margin-top:12rpx;">
			<view class="past" style="padding-bottom: 16rpx;">
				<view class="inner">
					<view class="past-line">家属信息</view>
				</view>
			</view>
			
			<view class="past">
				<view class="inner" @click="goOut(3,info)">
					<view class="past-content">
						<view class="left">姓名：</view>
						<view>{{info.consultPersonName}}</view>
					</view>
				</view>
			</view>
			
			<view class="past">
				<view class="inner" @click="goOut(4,info)">
					<view class="past-content">
						<view class="left">与长者关系：</view>
						<view>{{info.relationship}}</view>
					</view>
				</view>
			</view>
			<view class="pasts" @click="goOut(5,info)">
				<view class="inner">
					<view class="past-content">
						<view class="left">联系电话：</view>
						<view>{{info.consultTelephone}}</view>
					</view>
				</view>
			</view>
		</view>
	</view>
	
	</view>
</template>
<script>
	export default {
		data() {
			return {
				item:{},//上个页面object
				id:'',////老人id
				info:{},//接口老人信息
				show:false//是否展示
			}
		},
		onLoad(options) {
			this.item = JSON.parse(options.item);
			this.id = this.item.oldBaseId
			this.onloads()
		},
		methods: {
			goOut(index,info){
				switch(index){
					case 0:	
						if(this.$store.state.state&&this.$store.state.isphone){
							getApp().globalData.TTSSpeaker.stop();
							getApp().globalData.TTSSpeaker.speak(`
								既往史${info.pastMedicalHistory?info.pastMedicalHistory:""}
							`,1);
						}
					break
					case 1:
						if(this.$store.state.state&&this.$store.state.isphone){
							getApp().globalData.TTSSpeaker.stop();
							getApp().globalData.TTSSpeaker.speak(`
								现病史${info.nowMedicalHistory?info.nowMedicalHistory:""}
							`,1);
						}
					break
					case 2:
						if(this.$store.state.state&&this.$store.state.isphone){
							getApp().globalData.TTSSpeaker.stop();
							getApp().globalData.TTSSpeaker.speak(`
								饮食${info.diet?info.diet:""}
							`,1);
						}
					break
					case 3:
						if(this.$store.state.state&&this.$store.state.isphone){
							getApp().globalData.TTSSpeaker.stop();
							getApp().globalData.TTSSpeaker.speak(`
								姓名${info.consultPersonName?info.consultPersonName:""}
							`,1);
						}
					break
					case 4:
						if(this.$store.state.state&&this.$store.state.isphone){
							getApp().globalData.TTSSpeaker.stop();
							getApp().globalData.TTSSpeaker.speak(`
								与长者关系${info.relationship?info.relationship:""}
							`,1);
						}
					break
					case 5:
						if(this.$store.state.state&&this.$store.state.isphone){
							getApp().globalData.TTSSpeaker.stop();
							getApp().globalData.TTSSpeaker.speak(`
								联系电话${info.consultTelephone?info.consultTelephone:""}
							`,1);
						}
					break
				}
			},
			onloads(){
				let param = {}
				param.id = this.id
				this.$http('/care-service/oldBaseDetail/getOldBaseInfo','get',param).then(res=>{
					if(res.data.code==200){
						this.info = res.data.data
						 console.log(this.info)
						 this.show = true
					}
				});
			},
			getContent(item){
				if(this.$store.state.state&&this.$store.state.isphone){
					getApp().globalData.TTSSpeaker.stop();
					getApp().globalData.TTSSpeaker.speak(`
						姓名${item.oldBaseName?item.oldBaseName:""}，年龄，${item.age?item.age:""}岁，房间：${item.roomName?item.roomName:""},床位${item.bedName?item.bedName:""}能力等级
						${item.abilityLevel?item.abilityLevel:""}修养类型${item.cultureType?item.cultureType:""}责任护理员${item.responsePerson?item.responsePerson:""}
					`,1);
				}
			}
		}
	}
</script>

<style scoped lang="scss">
	.padding-sm{
		background-color:#F2F2F2;
	}
	.information{
		padding: 40rpx 80rpx 30rpx 20rpx;
		display: flex;
		.image{
			width:120rpx;
			margin-right: 20rpx;
			display: flex;
			justify-content: center;
			align-items: flex-start;
			image{
				width: 100rpx;
				height: 100rpx;
			}
		}
		.right{
			flex: 1;
			.name{
				display: flex;
				.center{
					margin-left: 80rpx;
					flex:1;
				}
				.inner{
					font-size:38rpx;
				}
			}
			.room{
				margin: 12rpx 0;
				display: flex;
				.room-left{
					flex: 1;
				}
			}
			.power{
				display: flex;
				.power-left{
					margin-right: 12rpx;
				}
			}
			.power-center{
				margin:12rpx 0;
			}		
		}
	}
	.condition{
		padding:0 12rpx;
		padding-top:20rpx;
		background-color: #FFFFFF;
		.past-line{
			border-left:1rpx solid #0081FF;
			padding-left:20rpx;
		}
		.inner{
			padding: 0 20rpx;
		}
		.past{
			border-bottom: 1rpx solid #CCCCCC;
		}
		.pasts{
			border-bottom: none;
			padding-bottom: 10rpx;
		}
		.past-content{
			display: flex;
			margin:16rpx 0;
			.left{
				width:220rpx;
				padding-left:4rpx;
			}
		}
	}
	
</style>
